﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EcoSystem.Permissions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Authorization.Permissions;

namespace EcoSystem.Dictionarys;

/// <summary>
/// 用户全局配置调用控制器
/// </summary>
[Area(EcoSystemRemoteServiceConsts.ModuleName)]
[RemoteService(Name = EcoSystemRemoteServiceConsts.RemoteServiceName)]
[Route("api/Platform/configuration")]
public class ConfigurationController : EcoSystemController, IConfigurationAppService
{
    private readonly IConfigurationAppService _service;

    public ConfigurationController(IConfigurationAppService service)
    {
        _service = service;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    /// <exception cref="NotImplementedException"></exception>
    [HttpGet]
    public async Task<AppConfigurationDto> GetApplicationConfigurationAsync()
    {
        return await _service.GetApplicationConfigurationAsync();
    }

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    [Route("dictionayItems")]
    public async Task<List<DictionaryDto>> GetDictionaryAsync()
    {
        return await _service.GetDictionaryAsync();
    }

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    /// <exception cref="NotImplementedException"></exception>
    [HttpGet]
    [Route("menuItems")]
    public async Task<List<SystemMenuDto>> GetMenusAsync()
    {
        return await _service.GetMenusAsync();
    }

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    [Route("permissionDefinitions")]
    [AllowAnonymous]
    public async Task<List<PermissionDefinitionDto>> GetPermissionDefinitionsAsync()
    {

        return await _service.GetPermissionDefinitionsAsync();
    }
}
